<template>
  <div style="width: 100%; height: 100%">
    <div
      style="
        width: 100%;
        height: 70px;
        display: flex;
        padding: 0 15px;
        justify-content: space-between;
        align-items: center;
        position: relative;
      ">
      <div class="title">
        <img src="@/assets/images/welcomeTitle1.png">
        通知公告
      </div>

      <div class="more" @click="$router.push('/cms/check-management/cms/statistical-report/warn-information')">
        更多
        <i class="el-icon-d-arrow-right" />
      </div>
    </div>
    <div
      style="
        height: calc(100% - 70px);
        width: 100%;
        padding-top: 10px;
        overflow: auto;
      ">
      <div
        v-for="(item, index) in data"
        :key="index"
        class="list_item"
        @click="seeNotice(item, data, index)">
        <div class="list_title" :title="item.warnTitle">{{ item.warnTitle }}</div>
        <div class="date">{{ item.createDate }}</div>
      </div>
    </div>
  </div>
</template>
<script>
import { earlyWarning } from '@/api/cms/index/index.js'
export default {
  components: {},
  props: {
    deptCode: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      data: []
    }
  },

  mounted() {
    this.init()
  },
  methods: {
    init() {
      earlyWarning({ deptCode: this.deptCode }).then((res) => {
        this.data = res.data.records
      })
    },
    seeNotice(data, arr, index) {
      this.$emit('seeNotice', {
        item: data,
        data: arr,
        index: index
      })
    }
  }
}
</script>
<style lang="scss" scoped>
.title {
  font-style: normal;
  font-weight: normal;
  font-size: 22px;
  display: flex;
  align-items: center;
  height: 70px;
  line-height: 70px;
  z-index: 99;
}
.more {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%s);
  font-size: 16px;
  cursor: pointer;
  color: #66ffff;
}
.list_item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 42px;
  line-height: 42px;
  width: 100%;
  padding: 0 30px;
}
.list_title {
  font-size: 14px;
  width: 60%;
  align-items: center;
  color: #66ffff;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.date {
  font-size: 14px;
  display: flex;
  align-items: center;
  color: #cce7ff;
}
.list_item:nth-child(odd) {
  background-color: rgba(0, 70, 120, 0.3);
}
.title_bg {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
}
</style>
